<!DOCTYPE html>
<html>

<head>
    <title>北京站网格化系统</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Fonts -->
    <link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:300,400' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,900' rel='stylesheet' type='text/css'>
    <!-- CSS Libs -->
    <link rel="stylesheet" type="text/css" href="../lib/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/bootstrap-switch.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/checkbox3.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/jquery.dataTables.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/dataTables.bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/select2.min.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/validform.min.css">
    <!-- CSS App -->
    <link rel="stylesheet" type="text/css" href="../lib/css/common/style.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/common/themes/flat-blue.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/common/newstyle.css">
    
    <!-- CSS datetimepick -->
    <!-- <link rel="stylesheet" type="text/css" href="../lib/css/jquery.datetimepicker.css"> -->
    <!--  -->
    <link rel="stylesheet" type="text/css" href="../lib/css/baseCommon.css">
    <link rel="stylesheet" type="text/css" href="../lib/css/zc-common.css">
    <link rel="stylesheet" type="text/css" href="../lib/js/jquery-treegrid-master/jquery.treegrid.css">
    <!-- datatable CSS -->
    <!-- <link rel="stylesheet" type="text/css" href="../lib/css/jquery.dataTables.min.css"> -->
    <!-- <link rel="stylesheet" type="text/css" href="../lib/css/dataTables.bootstrap.css"> -->
    <!-- css page -->
    <!-- <link rel="stylesheet" type="text/css" href="../lib/css/pagination.css"> -->
     <!-- Javascript Libs -->
    <script type="text/javascript" src="../lib/js/jquery.min.js"></script>
    <script type="text/javascript" src="../lib/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../lib/js/Chart.min.js"></script>
    <script type="text/javascript" src="../lib/js/bootstrap-switch.min.js"></script>
    <script type="text/javascript" src="../lib/js/jquery.matchHeight-min.js"></script>
    <script type="text/javascript" src="../lib/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="../lib/js/dataTables.bootstrap.min.js"></script>
    <script type="text/javascript" src="../lib/js/select2.full.min.js"></script>
    <script type="text/javascript" src="../lib/js/ace/ace.js"></script>
    <script type="text/javascript" src="../lib/js/ace/mode-html.js"></script>
    <script type="text/javascript" src="../lib/js/ace/theme-github.js"></script>
    <script type="text/javascript" src="../lib/js/datetimepicker.js"></script>
    <script type="text/javascript" src="../lib/js/validform.js"></script>
    <!-- Javascript -->
    <script src="../lib/js/vue.js"></script>
    <script type="text/javascript" src="../lib/js/common/app.js"></script>
    <!-- <script type="text/javascript" src="../lib/js/common/index.js"></script> -->
    <!-- Javascript -->
    <script src="../lib/js/jquery-treegrid-master/jquery.treegrid.min.js"></script>
    <script src="../lib/js/organization.js"></script>
    <script type="text/javascript" src="../lib/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="../lib/js/dataTables.bootstrap.min.js"></script>
    <script src="../lib/js/jquery-treegrid-master/jquery.treegrid.bootstrap3.js"></script>
    <script src="../lib/js/jquery-treegrid-master/jquery.treegrid.extension.js"></script>
    <script type="text/javascript" src="../lib/js/depchoice/edep_plugin.js"></script>
    <script type="text/javascript" src="../lib/js/ztreeJs.js"></script>
</head>

<body class="flat-blue">
    <div class="app-container expanded">
        <div class="row content-container">
             <nav class="navbar navbar-default navbar-fixed-top navbar-top">
                <div class="container-fluid">
                   <div class="navbar-header">
                        <button type="button" class="navbar-expand-toggle fa-rotate-90">
                            <i class="fa fa-bars icon"></i>
                        </button>
                        <ul class="nav navbar-nav navbar-left no-border">
                                <li class=""><a href="./organization-base-depsetting.html">部门设置</a></li>
                                <li class=""><a href="./organization-base-role.html">角色设置</a></li>
                                <li class="active"><a href="./organization-base-station.html">岗位设置</a></li>
                                <li class=""><a href="./organization-base-info.html">组织信息</a></li>
                        </ul>
                    </div>
                </div>
            </nav>
            <div class="side-menu sidebar-inverse">
                <nav class="navbar navbar-default" role="navigation">
                    <div class="side-menu-container">
                        <div class="navbar-header">
                            <a class="navbar-brand" href="#">
                                <div class="icon fa fa-train"></div>
                                <div class="title">北京站</div>
                            </a>
                            <button type="button" class="navbar-expand-toggle pull-right visible-xs">
                                <i class="fa fa-times icon"></i>
                            </button>
                        </div>
                        <ul class="nav navbar-nav">
                            <li class="panel panel-default dropdown active">
                                <a data-toggle="collapse"  href="#dropdown-organization">
                                    <span class="icon fa fa-users"></span><span class="title">组织管理</span>
                                </a>
                            </li>
                            <li class="panel panel-default dropdown">
                                <a data-toggle="collapse" href="#dropdown-device">
                                    <span class="icon fa fa-wrench"></span><span class="title">设备管理</span>
                                </a>
                            </li>
                            <li class="panel panel-default dropdown">
                                <a data-toggle="collapse" href="#dropdown-quantitave">
                                    <span class="icon fa fa-trophy"></span><span class="title">量化任务</span>
                                </a>
                            </li>
                            <li class="panel panel-default dropdown">
                                <a data-toggle="collapse" href="#dropdown-info">
                                    <span class="icon fa fa-comment"></span><span class="title">信息管理</span>
                                </a> 
                            </li>
                            <li class="panel panel-default dropdown">
                                <a data-toggle="collapse" href="#dropdown-task">
                                    <span class="icon fa fa-road"></span><span class="title">作业管理</span>
                                </a>
                            </li>
                            <li class="panel panel-default dropdown">
                                <a data-toggle="collapse" href="#dropdown-emergency">
                                    <span class="icon fa fa-bolt"></span><span class="title">应急处置</span>
                                </a>
                            </li>
                        </ul>
                        
                    </div>
                    <!-- /.navbar-collapse -->
                </nav>
                <div class="nav-bar2">
                    <div class="navbar-title">
                        <p class="title">组织管理</p>
                    </div>
                    <div id="dropdown-organization" class="panel-collapse collapse in" aria-expanded="true">
                        <ul class="nav navbar-nav">
                            <li><a href="./organization-base-depsetting.html">基础信息</a></li>
                            <li><a href="./organization-people-base.html">人员信息管理</a></li>
                            <li><a href="./organization-grid-manage.html">网格管理</a></li>
                        </ul>
                    </div>
                    <div id="dropdown-device" class="panel-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="./device-base.html">设备信息</a></li>
                        </ul>
                    </div>
                    <div id="dropdown-quantitave" class="panel-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="./quantitave-manage.html">任务管理</a></li>
                        </ul>
                    </div>
                    <div id="dropdown-info" class="panel-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="./info-manage.html">信息分类</a></li>
                        </ul>
                    </div>
                    <div id="dropdown-task" class="panel-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="./task-flow.html">作业流程管理</a></li>
                            <li><a href="./task-base.html">作业任务管理</a></li>
                            <li><a href="./task-train-info.html">列车信息管理</a></li>
                        </ul>
                    </div>
                    <div id="dropdown-emergency" class="panel-collapse collapse">
                        <ul class="nav navbar-nav">
                            <li><a href="./emergency-base.html">应急处置管理</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- Main Content -->
            <div class="container-fluid">
                <div class="side-body padding-top">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="card card_list">
                                    <!-- 表格 -->
                                    <div class="elm-wrap">
                                        <button type="button" class="btn btn-info" onclick="editing('post')">添加岗位</button>
                                    </div>
                                    <div class="elm-wrap table_style">
                                        <table id="table_id_example"  class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                                <tr>
                                                    <th>岗位名称</th>
                                                    <th>岗位说明</th>
                                                    <th>所属部门</th>
                                                    <th>岗位类别</th>
                                                    <th>作业人员</th>
                                                    <th>责任网格</th>
                                                    <th>操作</th>
                                                </tr>
                                            </thead>
                                            <tfoot>
                                                <tr>
                                                    <th>岗位名称</th>
                                                    <th>岗位说明</th>
                                                    <th>所属部门</th>
                                                    <th>岗位类别</th>
                                                    <th>作业人员</th>
                                                    <th>责任网格</th>
                                                    <th>操作</th>
                                                </tr>
                                            </tfoot>
                                            <tbody class="table_body">
                                            </tbody>
                                    </table>
                                    </div>      
                            </div>
                            <div class="card card_edit">
                                <div class="card-body">
                                    <form class="form-horizontal postvue" style="margin-top:30px">
                                        <div class="form-group">
                                            <label for="post_name" class="col-sm-2 control-label">岗位名称： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <input type="text" class="form-control post_name" id="post_name" name="post_name" datatype="*" errormsg="请填写正确的岗位名称" nullmsg="岗位名称是必填的" placeholder="请输入岗位名称" v-model="info.post_name">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="dep" class="col-sm-2 control-label">所属部门： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <select class="form-control dep" name="dep" id="dep" aria-placeholder="所属部门" style="width:100%"></select> 
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="grid" class="col-sm-2 control-label">责任网格： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <select class="form-control grid" name="grid" id="grid" aria-placeholder="请添加责任网格" style="width:100%">
                                                </select> 
                                            </div>
                                        </div>
                                        <div class="form-group" v-for="s in gogo">
                                            <label for="" class="col-sm-2 control-label">测试： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <select v-select2="{url:url.base+url.department+'department_list'}" class="form-control" name="df" id="" aria-placeholder="请添加责任网格" style="width:100%" v-model="s.s" multiple >
                                                </select> 
                                            </div>
                                        </div>
                                        <div class="form-group" v-for="s in gogo2">
                                            <label for="" class="col-sm-2 control-label">测试2： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <select v-select2="{url:url.base+url.department+'department_list',multiple:false}" class="form-control" name="df" id="" aria-placeholder="请添加责任网格" style="width:100%" v-model="s.s" >
                                                </select> 
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="dep" class="col-sm-2 control-label">岗位类别：</label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <div class="radio3 radio-check radio-blue radio-inline">
                                                    <input type="radio" id="radio4" v-model="info.post_type_id" name="post_type" value="2">
                                                    <label for="radio4">
                                                        作业岗位
                                                    </label>
                                                </div>
                                                <div class="radio3 radio-check radio-blue radio-inline">
                                                    <input type="radio" id="radio5" v-model="info.post_type_id" name="post_type" value="1">
                                                    <label for="radio5">
                                                        作业人员
                                                    </label>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group" v-if="showUser">
                                            <label for="post_user" class="col-sm-2 control-label">作业人员： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <input id="userid" type="hidden">
                                                <div class="departSelect">
                                                    <div type="text" class="form-control user tagselect" id="user" name="user" placeholder=""></div>
                                                    <div id="usergroup" class="groudtree"></div>    
                                                </div> 
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="post_desc" class="col-sm-2 control-label">岗位说明： </label>
                                            <div class="col-sm-10 col-md-6 col-lg-4">
                                                <textarea name="post_desc" class="form-control post_desc" rows="3" v-model="info.post_desc"></textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-offset-2 col-sm-10">
                                                <button type="button" class="btn btn-info edited" onclick="uploadData('post')">添加岗位</button>
                                                <button type="button" class="btn btn-default edit_cancel">取消</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="modalDel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel">删除岗位</h4>
                        </div>
                        <div class="modal-body">
                            确定删除岗位？
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default cancel" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-info deling">确认</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="modalTips" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel3">提示</h4>
                        </div>
                        <div class="modal-body">
                            温馨提示
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div>
</body>
<script>
    var _dataTable = $("#table_id_example").DataTable({
        "dom": '<"top"fl<"clear">>rt<"bottom"ip<"clear">>',
        language:{
            url: '../lib/js/cn_lang.json'
        },
        ajax:{
            url:serverUrl.base + serverUrl.post + 'post_list'
        },
        ordering:false,
        columns:[
            { "data": "post_name" },
            { "data": "post_desc" },
            { "data": "department_name" },
            { "data": "post_type_name" },
            { "data": "post_user",width:"30%"},
            { "data": "post_grid",width:"30%"},
            {
                "data":null,render:function(data, type, row, meta){
                    //console.log()
                    return '<a onclick="editing(\'post\',this)" href="javascript:void(0)">编辑</a> <a onclick="delingModal(\'post\',this)" href="javascript:void(0)">删除</a>'
                },defaultContent:''
            }
            
        ]  
    })
    var Info={}
    function editing(name,elm){
        switch(name){
            case 'post':
                $('.card_edit').show()
                $('.card_list').hide()
                Info = {
                    post_name:'',
                    post_type_id:1,
                    department_id:'',
                    department_name:'',
                    post_user:[],
                    post_desc:''
                }
                if(arguments[1]){
                    $('.edited').text('编辑岗位')
                    Info =$.extend({},_dataTable.row($(elm).parents('tr')).data()) 
                    $.post(serverUrl.base+serverUrl.post+'post_info',{post_id:Info.post_id},function(res){
                        Info = $.extend({},Info,res.data)
                        $('#depid').val(Info.department_id)
                        $('#dep').val(Info.department_name)
                        posVue.info = Info
                        tagSelected({data:Info.post_user,elmName:'user',delFn:function(elm,id,data){
                            Info.post_user = Info.post_user.filter(function(v){
                                return v.id != id
                            })   
                            Info._post_user_id=[]
                            
                            $('#userid').val(Info._post_user_id.join(','))
                        }}) //复选树初始化
                        Info._post_user_id = []
                        $.each(Info.post_user,function(val,elm){
                            Info._post_user_id.push(elm.id)
                        })
                        $('#userid').val(Info._post_user_id.join(','))
                        $('select.grid').val(Info.post_grid).trigger('change')//select2 选择框初始化
                        
                    },'json')
                }else{
                    $('.edited').text('添加岗位')
                    posVue.info = Info
                }
                
                
            break;
            default:
                $('.card_edit').show()
                $('.card_list').hide()
                Info = {}
            break;
        }
        if(arguments[1]){
            Info.row = $(elm).parents('tr')
        }
    }
    function delingModal(name,elm){
        switch(name){
            case 'post':
                Info.row = $(elm).parents('tr')
                _id = _dataTable.row(Info.row).data().post_id
                var _text={
                    tit:'删除岗位',
                    body1:'确定删除岗位？',
                    body2:'当前岗位与接发车作业任务、量化任务、设备维修/巡检/验收任务、应急处置等模块相关联，删除后会影响部分功能无法正常使用，请先取消与相关模块的关联后再删除此岗位。',
                    btn1:'确定',
                    cbtn1:'取消',
                    cbtn2:'知道了'
                }
                $.post(serverUrl.base+serverUrl.post+'can_del',{post_id:_id},function(res){
                    if(res.code == 0){
                        $('#modalDel').find('.modal-body').text(_text.body1)
                        $('#modalDel').find('.modal-footer .deling').show()
                        $('#modalDel').find('.modal-footer .cancel').text(_text.cbtn1)
                    }else if(res.code == 1){
                        $('#modalDel').find('.modal-body').text(_text.body2)
                        $('#modalDel').find('.modal-footer .cancel').text(_text.cbtn2)
                        $('#modalDel').find('.modal-footer .deling').hide()
                    }
                    $('#modalDel').modal()
                },'json')
            break;
            default:
            break;
        }
    }
    $('.deling').on('click',function(){
        $('#modalDel').modal('hide')
        var _id = _dataTable.row(Info.row).data().post_id;
        $.post(serverUrl.base+serverUrl.post+'del_post',{post_id:_id},function(res){
            if(res.code == 0){
                setTimeout(function(){
                    $('#modalTips').find('.modal-body').text(res.info)
                    $("#modalTips").modal()    
                },500)
                _dataTable.row(Info.row).remove().draw(false)
            }else{
                setTimeout(function(){
                    $('#modalTips').find('.modal-body').text(res.info)
                    $("#modalTips").modal()    
                },500)
            }
        },'json')
    })
    Vue.directive('select2', {
        inserted: function (el, binding, vnode) {
            //console.log(binding.value)
            var opts = $.extend({
                isId:false,
                sel:'',
                url:'',
                type:'POST',
                baseData:{sel:1},
                data:{},
                datas:[],
                multiple:true,
                placeholder:'请选择选项',
                valide:'',
                hasAll:false
            },binding.value||{});
            //console.log(opts)
            if(opts.url){
                var _data = $.extend({},opts.baseData,opts.data)
                $.ajax({
                    url:opts.url,
                    type:opts.type,
                    data:_data,
                    dataType:"json",
                    success:function(res){
                        if(res.code == 0){
                            opts.datas = res.data
                            if(opts.hasAll){
                                opts.datas.splice(0,0,{id:'none',text:'全部'})
                            }   
                        }
                        $(el).select2({
                            placeholder:opts.placeholder,
                            data:opts.datas,
                            multiple:opts.multiple,
                            closeOnSelect:!opts.multiple
                        })
                        if(opts.valide && opts.valide != ''){
                            $(el).on("select2:close", function (e) {
                                var _check = opts.valide.check(false,$(e.currentTarget))
                            });
                            $(el).on("select2:select", function (e) {
                                var _check = opts.valide.check(false,$(e.currentTarget))
                            });
                            $(el).on("select2:unselect", function (e) {
                                opts.valide.check(false,$(e.currentTarget))
                            });
                        }
                        
                    },
                    complete:function(res){
                        
                    },
                    error:function(res){
                        console.log(res)
                    }    
                })
            }else{
                if(opts.datas.length != 0){
                    setTimeout(function(){//延迟一下 vue数据更新时就不会出现无法使用的问题了
                        if(opts.hasAll){
                            opts.datas.splice(0,0,{id:'none',text:'全部'})
                        }
                        $(el).select2({
                            placeholder:opts.placeholder,
                            data:opts.datas,
                            multiple: opts.multiple,
                            closeOnSelect: !opts.multiple
                        })
                    },0)
                }
            }
            
            $(el).on("select2:select", function(e){
                el.dispatchEvent(new Event('change', { target: e.target }));
            });
            $(el).on("select2:unselect", function(e){
                el.dispatchEvent(new Event('change', { target: e.target }));
            });
            
            
        },
        update: function (el, binding, vnode) {
            //console.log(posVue.gogo,posVue.gogo2)
            for(var i=0;i<vnode.data.directives.length;i++){
                if(vnode.data.directives[i].name=='model'){
                    $(el).val(vnode.data.directives[i].value)
                }
            }
            $(el).trigger("change");
        }
    });
    // 编辑
    var posVue = new Vue({
        el:'.postvue',
        data:{
            gogo:[{s:['1','2']},{s:['28']}],
            gogo2:[{s:'1'},{s:'2'}],
            info:{},
            url:vueStore.state.serverUrl,
            select2Data:vueStore.state.select2Datas
        },
        computed:{
            showUser:function(){
                return this.info.post_type_id != '2'
            }
        },
        methods:{

        },
        watch:{
            gogo:function(val){
                if(typeof(gogo) == 'string' )
                console.log(val)
                return [val]
            }
        },
        beforeUpdate:function(){
            //console.log($("#userid").val())
        },
        updated:function(){  
            //console.log(this.gogo)
        }
    })
    // 保存修改
    function uploadData(name){
        switch(name){
            case 'post':
                var _info = posVue.info,
                _upData={
                    post_id:_info.post_id,
                    post_name:_info.post_name,
                    post_type_id:_info.post_type_id,
                    post_grid:$('select.grid').val(),
                    department_id:$('#depid').val(),
                    post_user:_info.post_type_id == '1'?$('#userid').val()?$('#userid').val():[]:null,
                    post_desc:_info.post_desc
                }
                //console.log(_upData)
                //return false
                $.ajax({
                    url:serverUrl.base+serverUrl.post+'edit_post',
                    type:"POST",
                    data:_upData,
                    dataType:"json",
                    success:function(res){
                        if(res.code == 0){
                            _upData.department_name = Info.department_name
                            _upData._post_grid=[]
                            var _g=$('select.grid').select2('data')
                            for(var i=0;i<_g.length;i++){
                                _upData._post_grid.push(_g[i].text)
                            }
                            _upData.post_grid = _upData._post_grid.join('，')
                            if(_upData.post_type_id == '1'){
                                _upData.post_type_name = '作业人员'
                            }else{
                                _upData.post_type_name = '作业岗位'
                            }
                            var _t = $('#user').find('.circleGird')
                            _upData._post_user = []
                            _t.each(function(id,elm){
                                _upData._post_user.push($(elm).text())
                            })
                            _upData.post_user = _upData._post_user.join('，')
                            //更新表格
                            // _dataTable.settings()[0].ajax.data={'department_id':Info.department_id}
                            // _dataTable.ajax.reload()
                            if(Info.row){
                                _dataTable.row(Info.row).data(_upData).draw(false)
                            }else{
                                // _dataTable.row.add(_upData).draw(false)
                                _dataTable.ajax.reload()
                            }
                            Info = {}
                            $('.card_edit').hide()
                            $('.card_list').show()
                            $("#modalTips").find('.modal-title').text('成功') 
                            var _info=''
                            if($('.edited').text() ==  '添加岗位'){
                                _info = '添加岗位成功！'
                            }else{
                                _info = '修改岗位成功！'
                            }
                            $("#modalTips").find('.modal-body').text(_info)
                        }else if(res.code == '2'){
                            $("#modalTips").find('.modal-title').text('出现问题') 
                            $("#modalTips").find('.modal-body').text(res.info)
                        }
                        setTimeout(function(){
                            $("#modalTips").modal()    
                        },500)

                    },
                    complete:function(res){
                        $('#modalDel').modal('hide')
                    },
                    error:function(res){
                        $("#modalTips").find('.modal-title').text('出现问题') 
                        $("#modalTips").find('.modal-body').text(res.info)
                        setTimeout(function(){
                            $("#modalTips").modal()    
                        },500)
                    }    
                })
            break;
        }
    }
    //取消
    $(".edit_cancel").on('click',function(){
        $(".card_list").show();
        $(".card_edit").hide();
        Info={}
    })
    var datas = {
        grids:[
            {id:'1',text:'候车1'},
            {id:'2',text:'候车2'},
            {id:'3',text:'候车3'},
            {id:'4',text:'候车4'},
            {id:'5',text:'候车5'}
        ],
        xsStandard:[
            {id:'1',text:'2小时'},
            {id:'2',text:'6小时'},
            {id:'3',text:'8小时'},
            {id:'4',text:'12小时'}
        ],
        gridTips:[
            {id:'1',text:'站台区'},
            {id:'2',text:'候车区'},
            {id:'3',text:'厕所'},
            {id:'4',text:'售票厅'}
        ]
    }
    var myValidform = $(".ss_form").Validform({
        tiptype:2,
        datatype:{
            ztreegroup:function(gets,obj,curform,regxp){
                console.log(gets)
                if(gets == ''){
                    return false
                }else{
                }
            },
            select2:function(gets,obj,curform,regxp){
                if(gets.length ==0){
                    $('.select2-selection').css('borderColor','red')
                    return false
                }else{
                    $('.select2-selection').css('borderColor','#ccc')
                }
            }
        }
    });
    $(document).on('click','.user',function(){
        console.log($('#userid').val())
        showsDeptWin('user','userid','1',myValidform);
    })
    new rpSelect({
        sel:'dep',
        url:serverUrl.base+serverUrl.department+'department_list',
        multiple:false,
        placeholder:'选择部门'
    })
    new rpSelect({
        sel:'grid',
        url:serverUrl.base+serverUrl.grid+'grid_choice_list',
        placeholder:'选择责任网格'
    })
    
</script>
</html>
